import http from "./request";

// 登录
function login(userName, password) {
    return http.post('/api/v1/auth/login', {
        userName,
        password
    });
}

// 注册
function zhuce(obj) {
    return http.post('/api/v1/auth/reg', {
        userName: obj.userName,
        password: obj.password,
        birthday: obj.birthday,
        age: obj.age,
        avatar: obj.avatar,
        area: obj.area,
        address: obj.address,
        nickName: obj.nickName,
        gender: obj.gender
    });
}

// 获取用户信息
function userInfo() {
    return http.get('/api/v1/user/info');
}

// 修改个人信息
function updateInfo(obj){
	return http.put('/api/v1/user/modify',{
		birthday: obj.birthday,
		age: obj.age,
		avatar: obj.avatar,
		area: obj.area,
		address: obj.address,
		nickName: obj.nickName,
		gender: obj.gender
	})
}
// 修改密码
function updatePassWord(password,oldPassword){
	return http.put('/api/v1/user/update_pwd', {password,oldPassword});
}
export {
    login,
    zhuce,
    userInfo,
	updateInfo,
	updatePassWord
};